This section describes how the example source initiates an enrollment session with BenSelect. Please refer to the full sample code for the complete C# application source.
The Selerix .NET library includes a transmittal class that, together with intelligent code completion such as Microsoft's Intellisense, acts as a map to the Selerix data model. After populating the object with data, a call to the SerializationHelper method converts the object to transmittal XML. All data that can be exchanged in an integration between your site and BenSelect is exposed in this object. Developers instantiate the object, set the necessary properties, and serialize the object prior to uploading it to BenSelect.
In the example source, the Selerix data transmittal XML is created with this call to the transmittal object's SerializeToString method:
// Serialize the Transmittal object to XML using Selerix helper
string outboundXML = SerializationHelper.SerializeToString(theTransmittalObj);
Click here to see the Selerix Transmittal XML created by the sample code, which includes the most common data elements used by a Selerix enrollment. Refer to the transmittal object's Intellisense if additional information is required by the enrollment.
Once the transmittal object has been serialized to XML, send it to BenSelect with the Upload method. This method automatically converts the transmittal XML to HTML Entities, creates the necessary SOAP envelope, and injects the transmittal into the SOAP XML, and performs the HTTP POST to send the request message to BenSelect.
// Transmit the XML using the Upload method which handles the HTTP Post, passing
// the ID and password of the user setup on the case with the QX Enroller role
string returnedXML = enrollment.Upload("testcaseqxenroller", "thePassword", outboundXML);
After populating the transmittal, serializing and uploading it to BenSelect, the last step is to request a login GUID. Pass the GUID that identifies your enrollment group, sometimes referred to as the Portfolio ID, and the UniqueID that BenSelect includes in the return XML from the Upload call. This is achieved here in the sample code:
string uniqueID = applicant.Attributes["UniqueID"].Value;
...
// Lastly, obtain a login GUID which is used as part of the final enrollment URL
Guid loginGuid = enrollment.GetLoginGUID(
"testcaseqxenroller", "thePassword", "87902A63-3EF7-43FA-ADA2-D9C9C9B4E0FE", uniqueID
);
Once you have acquired the login GUID it is time to launch the BenSelect enrollment. This needs to be done quickly because the login GUID is only valid for a short period of time as a security precaution.
The URL used to launch the enrollment consists of the base URL provided by Selerix to your BenSelect enrollment group administrator plus the login GUID you just obtained. Optional URL arguments may also be added to enable or disable various parts of the BenSelect enrollment user interface. The example source constructs a URL and launches a Harmony BenSelect enrollment. If your integration targets a different BenSelect site, your base URL will differ from that in the example.
string enrollmentURL =
"https://benselect.com/Enroll/Login.aspx?login_guid=" + loginGuid.ToString() +
...
// The test code below launches BenSelect starting with the first enrollment using the
// default browser. In practice, the URL would be embedded in a HTML IFrame within
// your own enrollment application for seamless integration with BenSelect.
System.Diagnostics.Process.Start(enrollmentURL);